{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">资金明细</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('comment.commentlab/add')}"
                   data-auth-edit="{:$auth->check('comment.commentlab/edit')}"
                   data-auth-delete="{:$auth->check('comment.commentlab/del')}"></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/html" id="picTpl">
    <img style="max-width:100px; max-height:60px;" src="{{d.img_url}}" data-image="{{d.name}}">
</script>

<script type="text/html" id="barTool">

    <a class="layui-btn layui-btn-xs" data-open='{:url("edit")}?id={{ d.id }}' data-title="编辑内容"
       data-full="true">编辑</a>

    <a href='{:url("del",["catid"=>$catid])}?ids={{ d.id }}'
       class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del">删除</a>


</script>

<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" data-href='{:url("setstate")}?id={{d.id}}' value="{{d.id}}"
           lay-skin="switch"
           lay-text="启动|关闭" lay-filter="switchStatus" {{ d.status==1 ? 'checked' : '' }}>
</script>

<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: '{:url("tixian")}?sale_id={$sale_id}',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
        };

        table.render({
            init: init,
            toolbar: ['refresh',
                [{
                    text: '提现',
                    url: init.add_url,
                    method: 'open',
                    icon: 'iconfont icon-add',
                    class: 'layui-btn layui-btn-normal layui-btn-sm',
                    // extend: 'data-full="true"',
                }],
            ],
            // toolbar: ['refresh', 'add'],
            url: '{:url("funtlist")}?sale_id={$sale_id}',
            search: false,
            cols: [
                [
                    //名称 水票背景图 所属商品分类 所属商品
                    {field: 'id', width: '10%', align: "center", title: 'ID'},
                    {field: 'order_id', width: '10%', align: "center", title: '订单id'},
                    {
                        field: 'money', align: 'center', width: '25%', title: '金额', templet: function (d) {
                            if (d.is_count == 1) {
                                return '<span style="color: green;font-weight: 800">+' + d.money + '</span>';
                            } else {
                                return '<span style="color: red;font-weight: 800">-' + d.money + '</span>';
                            }
                        }, search: false
                    },
                    {
                        field: 'type', align: 'center', width: '25%', title: '类型', templet: function (d) {
                            if (d.type == 1) {
                                return '<span style="color: green;font-weight: 800">业务员到账</span>';
                            } else if (d.type == 2) {
                                return '<span style="color: green;font-weight: 800">商家到账</span>';
                            } else if (d.type == 3) {
                                return '<span style="color: red;font-weight: 800">业务提现</span>';
                            } else if (d.type == 4) {
                                return '<span style="color: red;font-weight: 800">商家提现</span>';
                            } else if (d.type == 5) {
                                return '<span style="color: red;font-weight: 800">业务扣款</span>';
                            } else if (d.type == 6) {
                                return '<span style="color: red;font-weight: 800">商家扣款</span>';
                            } else if (d.type == 7) {
                                return '<span style="color: green;font-weight: 800">业务经理到账</span>';
                            } else if (d.type == 8) {
                                return '<span style="color: red;font-weight: 800">业务经理扣款</span>';
                            } else {
                                return '<span style="color: black;font-weight: 800">其他</span>';
                            }
                        }, search: false
                    },
                    {field: 'create_time', width: '30%', align: "center", title: '创建时间'},
                    // {
                    //     field: 'status', width: '8%', align: "center", title: '提现状态', templet: function (d) {
                    //         if (d.status == 1) {
                    //             return '<span style="color: #00B83F">提现中</span>';
                    //         } else if (d.status == 2) {
                    //             return '<span style="color: #00B83F">已完成</span>';
                    //         } else {
                    //             return '<span style="color: #1e9fff">------</span>';
                    //         }
                    //     }, search: false
                    // },
                    // {field: 'finish_time', width: '15%', align: "center", title: '提现打款时间'},
                    // {fixed: 'right', width: '12%', title: '操作', toolbar: '#barTool'}
                ]
            ],
            page: {}
        });
        yznTable.bindevent();
        selectElement2 = document.getElementById('searchFieldset_currentTable');
        selectElement2.classList.remove("layui-hide");
        var element = document.getElementById('layui-input-search');
        element.parentNode.removeChild(element);
    });
</script>
{/block}